
DEFINE VARIABLE fld AS CHARACTER.

OUTPUT TO E:\myqad\ptsd_det.txt.

PUT UNFORMATTED "        case dt_field :" SKIP(1).

FOR EACH _file NO-LOCK WHERE _file-name = "ptsd_det" :
    FOR EACH _field OF _file NO-LOCK BY _order:

        IF _extent = 0 THEN
            fld = _field-name .
        ELSE
            fld = _field-name + "[1]".


        PUT UNFORMATTED "            when """ + fld + """ then" SKIP.

        IF  _data-type = "character" THEN
            PUT UNFORMATTED "                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptsd_det." + fld
                + ", input ptsd_det." + fld + "," SKIP.
        ELSE
            PUT UNFORMATTED "                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptsd_det." + fld
                + "), input string(ptsd_det." + fld + ")," SKIP.

        PUT UNFORMATTED "                    input recid(ptsd_det), input ptsd_det.ptsd_part, input ptsd_det.ptsd_sub_part, input ptsd_det.ptsd_vend, input """"," SKIP.

        PUT UNFORMATTED "                    input """", input """", input """", input """")." SKIP .

        PUT UNFORMATTED SKIP(1) .

    END.
END.

PUT UNFORMATTED "        end." SKIP(1).

OUTPUT CLOSE.


